package com.itheima.task;

import java.util.Random;
import java.util.Scanner;

public class task3 {
    public static void main(String[] args) {
        //键盘输入任意字符串，打乱里面的内容
        //1.键盘录入一个字符串
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String str = sc.next();
        //2.将字符串变成字符数组
        char[] chs = str.toCharArray();
        //3.打乱里面的内容
        Random r = new Random();
        for (int i = 0; i < chs.length; i++) {
            char temp =chs[i];
            int index = r.nextInt(chs.length);
            chs[i]=chs[index];
            chs[index]=temp;
        }
        String result = new String(chs);
        System.out.println(chs);
    }
}
